using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Diagnostics;

public partial class admin_AdminNews : System.Web.UI.Page
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        _newsForm.OnSaveComplete += new SaveComplete(OnNewsSaveComplete);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!User.IsInRole("Admin")) throw new Exception("Only admins can view this page!");
    }
    
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        int newsId = Convert.ToInt32(GridView1.SelectedRow.Cells[0].Text);
        _newsForm.LoadNewsArticle(newsId);
    }

    protected void OnNewsSaveComplete()
    {
        GridView1.DataBind();
    }
}
